package Model::Schema;
use strict;
use warnings;

use Rose::DB;
our @ISA = qw(Rose::DB);


=head1 NAME

Model::Schema - Database Class Encapsulation

=head1 DESCRIPTION

...

=cut

sub initialize
{
    my ($class, $base)     = @_;
       
       $class->register_db(
        domain   => $base->conf->{database}->{inuse},
        driver   => $base->conf->{database}->{$base->conf->{database}->{inuse}}->{type},
        database => $base->conf->{database}->{$base->conf->{database}->{inuse}}->{database},
        host     => $base->conf->{database}->{$base->conf->{database}->{inuse}}->{host},
        username => $base->conf->{database}->{$base->conf->{database}->{inuse}}->{user},
        password => $base->conf->{database}->{$base->conf->{database}->{inuse}}->{pass},
        server_time_zone => 'UTC',
      );
    
    $class->default_domain($base->conf->{database}->{inuse});
    
    my $db = $class->new;
    
    return $db or die $db->error;
}

=head1 AUTHOR

...

=head1 LICENSE

This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;
